package com.yanqu.road.server.logic.activity.condition.suitang;

import com.yanqu.road.entity.activity.ActivityConditionInfo;
import com.yanqu.road.entity.activity.ActivityInfo;
import com.yanqu.road.entity.enums.eGamePlayerEventType;
import com.yanqu.road.entity.task.args.UnionRiseRankArgs;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.gameplayer.module.task.TaskModule;
import com.yanqu.road.server.logic.activity.BaseActivityData;
import com.yanqu.road.server.logic.activity.condition.BaseActivityCondition;
import com.yanqu.road.server.logic.activity.condition.BaseUnionYRankCondition;
import com.yanqu.road.server.logic.activity.condition.BaseUserYRankCondition;
import com.yanqu.road.server.manger.activity.ActivityMgr;

public class SuiTangUnionScoreRankCondition extends BaseUnionYRankCondition {

    public SuiTangUnionScoreRankCondition(ActivityInfo activityInfo, ActivityConditionInfo activityConditionInfo, BaseActivityData baseActivityData) {
        super(activityInfo, activityConditionInfo, baseActivityData);
    }

    @Override
    protected void player_BoardLevelHandle(Object object) {
        UnionRiseRankArgs args = (UnionRiseRankArgs) object;
        if (null != args) {
            setValue(args.getValue());
            rankChange(args.getUnionUid(), args.getType());
        }
    }

    @Override
    public void addTrigger(GamePlayer player) {
        player.getModule(TaskModule.class).getGameEvent().addListener(eGamePlayerEventType.SuiTangUnionScoreRank.getValue(), handle);
    }

    @Override
    public void removeTrigger(GamePlayer player) {
        player.getModule(TaskModule.class).getGameEvent().removeListener(eGamePlayerEventType.SuiTangUnionScoreRank.getValue(), handle);
    }

    @Override
    public boolean canChange(ActivityInfo curActivity){
        return ActivityMgr.activityInShowTime(curActivity);
    }
}
